/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package GUI;

import java.awt.CardLayout;
import java.awt.Font;
import java.awt.Label;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.awt.font.TextAttribute;
import java.util.Map;
import javax.swing.JPanel;

/**
 *
 * @author CHX_93
 */
public class Gui_HocVien_root extends javax.swing.JFrame {

    /**
     * Creates new form Gui_HocVien_root
     */
    public Gui_HocVien_root() {
        initComponents();
        gui_HocVien_2.hide();
        gui_HocVien_3.hide();

        Font font = lb_xemThongTin.getFont();
        Map attributes_underline = font.getAttributes();
        attributes_underline.put(TextAttribute.UNDERLINE, TextAttribute.UNDERLINE_ON);
        gui_HocVien_1.setFont(font.deriveFont(attributes_underline));

        lb_xemThongTin.addMouseListener(listener_mouse);
        lb_XemTKB.addMouseListener(listener_mouse);
        lb_xemHocPhi.addMouseListener(listener_mouse);
    }

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jPanel_hocvien = new javax.swing.JPanel();
        jButton_thoat = new javax.swing.JButton();
        panel_chucnang = new javax.swing.JPanel();
        lb_xemThongTin = new javax.swing.JLabel();
        lb_XemTKB = new javax.swing.JLabel();
        lb_xemHocPhi = new javax.swing.JLabel();
        lb_xemCTHKiToi = new javax.swing.JLabel();
        lb_XemKQHoc = new javax.swing.JLabel();
        lb_TraCuuTTGV = new javax.swing.JLabel();
        jLabel_tenForm = new javax.swing.JLabel();
        panel_cardLayout = new javax.swing.JPanel();
        gui_HocVien_1 = new GUI.Gui_HocVien_1();
        gui_HocVien_2 = new GUI.Gui_HocVien_2();
        gui_HocVien_3 = new GUI.Gui_HocVien_3();
        gui_HocVien_4 = new GUI.Gui_HocVien_4();
        gui_HocVien_5 = new GUI.Gui_HocVien_5();
        gui_HocVien_6 = new GUI.Gui_HocVien_6();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);

        jPanel_hocvien.setLayout(new java.awt.GridLayout(1, 0));

        jButton_thoat.setText("Thoát");

        panel_chucnang.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Chức năng", javax.swing.border.TitledBorder.LEADING, javax.swing.border.TitledBorder.TOP));
        panel_chucnang.setAlignmentX(1.0F);
        panel_chucnang.setAlignmentY(1.0F);
        panel_chucnang.setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR));
        panel_chucnang.setMaximumSize(new java.awt.Dimension(130, 120));
        panel_chucnang.setName(""); // NOI18N
        panel_chucnang.setPreferredSize(new java.awt.Dimension(130, 120));

        lb_xemThongTin.setText("Xen thông tin cá nhân");
        lb_xemThongTin.setToolTipText("");
        lb_xemThongTin.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
        lb_xemThongTin.setName("Xen thông tin cá nhân"); // NOI18N

        lb_XemTKB.setText("Xen thời khoá biểu");
        lb_XemTKB.setToolTipText("");
        lb_XemTKB.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
        lb_XemTKB.setName("Xen thời khoá biểu"); // NOI18N

        lb_xemHocPhi.setText("Xen học phí");
        lb_xemHocPhi.setToolTipText("");
        lb_xemHocPhi.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
        lb_xemHocPhi.setName("Xen học phí"); // NOI18N

        lb_xemCTHKiToi.setText("<html>Xen chương trình học kì tới</html>\n");
        lb_xemCTHKiToi.setToolTipText("");
        lb_xemCTHKiToi.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
        lb_xemCTHKiToi.setName("Xen học phí"); // NOI18N

        lb_XemKQHoc.setText("Xem kết quả học tập");
        lb_XemKQHoc.setToolTipText("");
        lb_XemKQHoc.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
        lb_XemKQHoc.setName("Xen học phí"); // NOI18N

        lb_TraCuuTTGV.setText("<htmL>Tra cứu thông tin giáo viên</htm>");
        lb_TraCuuTTGV.setToolTipText("");
        lb_TraCuuTTGV.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
        lb_TraCuuTTGV.setName("Xen học phí"); // NOI18N

        javax.swing.GroupLayout panel_chucnangLayout = new javax.swing.GroupLayout(panel_chucnang);
        panel_chucnang.setLayout(panel_chucnangLayout);
        panel_chucnangLayout.setHorizontalGroup(
            panel_chucnangLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(panel_chucnangLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(panel_chucnangLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addComponent(lb_XemKQHoc)
                    .addComponent(lb_xemThongTin)
                    .addComponent(lb_xemHocPhi)
                    .addComponent(lb_XemTKB)
                    .addComponent(lb_xemCTHKiToi, javax.swing.GroupLayout.DEFAULT_SIZE, 116, Short.MAX_VALUE)
                    .addComponent(lb_TraCuuTTGV, javax.swing.GroupLayout.PREFERRED_SIZE, 0, Short.MAX_VALUE))
                .addContainerGap(24, Short.MAX_VALUE))
        );
        panel_chucnangLayout.setVerticalGroup(
            panel_chucnangLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(panel_chucnangLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(lb_xemThongTin)
                .addGap(18, 18, 18)
                .addComponent(lb_XemTKB)
                .addGap(18, 18, 18)
                .addComponent(lb_xemHocPhi)
                .addGap(18, 18, 18)
                .addComponent(lb_XemKQHoc)
                .addGap(18, 18, 18)
                .addComponent(lb_xemCTHKiToi, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(18, 18, 18)
                .addComponent(lb_TraCuuTTGV, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        jLabel_tenForm.setFont(new java.awt.Font("Tahoma", 1, 24)); // NOI18N
        jLabel_tenForm.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jLabel_tenForm.setText("HỌC VIÊN");

        panel_cardLayout.setLayout(new java.awt.CardLayout());
        panel_cardLayout.add(gui_HocVien_1, "card2");
        panel_cardLayout.add(gui_HocVien_2, "card3");
        panel_cardLayout.add(gui_HocVien_3, "card4");

        javax.swing.GroupLayout gui_HocVien_4Layout = new javax.swing.GroupLayout(gui_HocVien_4);
        gui_HocVien_4.setLayout(gui_HocVien_4Layout);
        gui_HocVien_4Layout.setHorizontalGroup(
            gui_HocVien_4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 628, Short.MAX_VALUE)
        );
        gui_HocVien_4Layout.setVerticalGroup(
            gui_HocVien_4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 537, Short.MAX_VALUE)
        );

        panel_cardLayout.add(gui_HocVien_4, "card6");

        javax.swing.GroupLayout gui_HocVien_5Layout = new javax.swing.GroupLayout(gui_HocVien_5);
        gui_HocVien_5.setLayout(gui_HocVien_5Layout);
        gui_HocVien_5Layout.setHorizontalGroup(
            gui_HocVien_5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 616, Short.MAX_VALUE)
        );
        gui_HocVien_5Layout.setVerticalGroup(
            gui_HocVien_5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 514, Short.MAX_VALUE)
        );

        panel_cardLayout.add(gui_HocVien_5, "card5");

        javax.swing.GroupLayout gui_HocVien_6Layout = new javax.swing.GroupLayout(gui_HocVien_6);
        gui_HocVien_6.setLayout(gui_HocVien_6Layout);
        gui_HocVien_6Layout.setHorizontalGroup(
            gui_HocVien_6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 628, Short.MAX_VALUE)
        );
        gui_HocVien_6Layout.setVerticalGroup(
            gui_HocVien_6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 537, Short.MAX_VALUE)
        );

        panel_cardLayout.add(gui_HocVien_6, "card7");

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addComponent(jPanel_hocvien, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createSequentialGroup()
                        .addComponent(panel_chucnang, javax.swing.GroupLayout.PREFERRED_SIZE, 162, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(layout.createSequentialGroup()
                                .addGap(0, 0, Short.MAX_VALUE)
                                .addComponent(jButton_thoat))
                            .addComponent(panel_cardLayout, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))
                    .addComponent(jLabel_tenForm, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                .addContainerGap())
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jPanel_hocvien, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGroup(layout.createSequentialGroup()
                        .addContainerGap()
                        .addComponent(jLabel_tenForm)))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(panel_chucnang, javax.swing.GroupLayout.DEFAULT_SIZE, 566, Short.MAX_VALUE)
                    .addGroup(layout.createSequentialGroup()
                        .addComponent(panel_cardLayout, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jButton_thoat)))
                .addContainerGap())
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    MouseListener listener_mouse = new MouseAdapter() {
        Font original;
        Map attributes;

        @Override
        public void mouseEntered(MouseEvent e) {
            original = e.getComponent().getFont();
            attributes = original.getAttributes();
            attributes.put(TextAttribute.UNDERLINE, TextAttribute.UNDERLINE_ON);

            e.getComponent().setFont(original.deriveFont(attributes));
        }

        @Override
        public void mouseExited(MouseEvent e) {
            e.getComponent().setFont(original);
        }

        @Override
        public void mousePressed(MouseEvent e) {
            String name = ((javax.swing.JLabel) e.getComponent()).getText();
            String[] nameList = new String[]{lb_xemThongTin.getText(), lb_XemTKB.getText(), lb_xemHocPhi.getText(),
                lb_XemKQHoc.getText(), lb_xemCTHKiToi.getText(), lb_TraCuuTTGV.getText()};
            JPanel[] panelList = new JPanel[]{gui_HocVien_1, gui_HocVien_2, gui_HocVien_3, gui_HocVien_4,
                gui_HocVien_5, gui_HocVien_6};

            for (int i = 0; i < nameList.length; i++) {
                if (name.equals(nameList[i])) {
                    panelList[i].show();
                    Font newFont = new Font(original.getName(), Font.BOLD, original.getSize());
                    e.getComponent().setFont(newFont);
                } else {
                    panelList[i].hide();
                }
            }
        }
    };

    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        /* Set the Nimbus look and feel */
        //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
        /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
         * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html 
         */
        try {
            for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
                if ("Nimbus".equals(info.getName())) {
                    javax.swing.UIManager.setLookAndFeel(info.getClassName());
                    break;
                }
            }
        } catch (ClassNotFoundException ex) {
            java.util.logging.Logger.getLogger(Gui_HocVien_root.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (InstantiationException ex) {
            java.util.logging.Logger.getLogger(Gui_HocVien_root.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (IllegalAccessException ex) {
            java.util.logging.Logger.getLogger(Gui_HocVien_root.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (javax.swing.UnsupportedLookAndFeelException ex) {
            java.util.logging.Logger.getLogger(Gui_HocVien_root.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        }
        //</editor-fold>

        /* Create and display the form */
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                new Gui_HocVien_root().setVisible(true);
            }
        });
    }

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private GUI.Gui_HocVien_1 gui_HocVien_1;
    private GUI.Gui_HocVien_2 gui_HocVien_2;
    private GUI.Gui_HocVien_3 gui_HocVien_3;
    private GUI.Gui_HocVien_4 gui_HocVien_4;
    private GUI.Gui_HocVien_5 gui_HocVien_5;
    private GUI.Gui_HocVien_6 gui_HocVien_6;
    private javax.swing.JButton jButton_thoat;
    private javax.swing.JLabel jLabel_tenForm;
    private javax.swing.JPanel jPanel_hocvien;
    private javax.swing.JLabel lb_TraCuuTTGV;
    private javax.swing.JLabel lb_XemKQHoc;
    private javax.swing.JLabel lb_XemTKB;
    private javax.swing.JLabel lb_xemCTHKiToi;
    private javax.swing.JLabel lb_xemHocPhi;
    private javax.swing.JLabel lb_xemThongTin;
    private javax.swing.JPanel panel_cardLayout;
    private javax.swing.JPanel panel_chucnang;
    // End of variables declaration//GEN-END:variables
}
